<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>Sdk系统登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/layui/2.8.8/css/layui.css" />
    <style>
        body {
            min-height: 100vh;
            background: #111;
            font: 14px/120% "Source Sans Pro", sans-serif;
            color: #999;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .login-container {
            background: rgba(17, 17, 17, 0.85);
            border-radius: 14px;
            box-shadow: 0 6px 32px rgba(0,0,0,0.4);
            padding: 48px 32px 0px 32px;
            max-width: 350px;
            width: 100%;
            margin: 32px auto;
            backdrop-filter: blur(12px);
            position: relative;
        }
        .logo-area {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 36px;
        }
        .logo-area img {
            height: 48px;
            width: auto;
            display: block;
            margin: 0;
            border-radius: 6px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.12);
        }
        .logo-area img+img {
            margin-left: 8px;
        }
        .login-title {
            text-align: center;
            color: #fff;
            margin-bottom: 50px;
            font-size: 1.5rem;
            letter-spacing: 2px;
            font-weight: 600;
        }
        .layui-form-label {
            color: #bbb !important;
        }

        .login-input {
            width: calc(100% - 20px);
            padding: 10px;
            margin: 20px auto;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            background: rgba(255, 255, 255, 0.1);
            color: #999;
            display: block;
        }

        .login-button {
            width: 100%;
            padding: 10px;
            margin: 50px auto;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            background-color: #2c3e50;
            color: #fff;
            cursor: pointer;
            transition: background-color 0.3s ease;
            display: block;
        }

        .login-button:hover {
            background-color: #34495e;
        }

        .login-link {
            display: block;
            margin-top: 20px;
            color: #666;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .login-link:hover {
            color: #fff;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="logo-area">
            <img src="" alt="logo1"/>
            <img src="" alt="logo2">
        </div>
        <div class="login-title">文档查看、SDK下载</div>
        <input type="text" class="login-input" id="username" placeholder="用户名">
        <input type="password" class="login-input" id="password" placeholder="密码">
        <button class="login-button">登录</button>
    </div>
</body>
<script src="https://releases.jquery.com/git/jquery-git.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/layui/2.8.8/layui.js"></script>
<script>
  var serverDomainUrl = window.location.protocol + "//" + window.location.hostname
  layui.use(['layer', 'element', 'form'], function(){
    var layer = layui.layer;
    var element = layui.element;
    var form = layui.form;

    $(".login-button").click(function(){
      var username = $("#username").val();
      var password = $("#password").val();
      if(username == "" || password == ""){
        layer.msg("用户名或密码不能为空");
        return;
      }
      $.ajax({
        type: "POST",
        url: serverDomainUrl + ":5000/checkSdkAccountPwdToDoc",
        data: {
          account: username,
          password: password
        },
        success: function(data){
          if(data && data.length > 0 && typeof data == "string" && data.indexOf("{") > -1){
            var retJson = JSON.parse(data);
            if(retJson.isSuccess && retJson.docHtml){
              layer.msg("登录成功");
              //setTimeout(function(){
                sessionStorage.setItem("userName", username);
                window.location.href = "../uploadApkClient/" + retJson.docHtml;
              //}, 1000)
            }else{
              layer.msg("登录失败，请确认账号信息再试");
            }
          }else{
            layer.msg("登录错误，请稍后再试");
          }
        },
        error: function(){
          layer.msg("登录异常，请稍后再试");
        }
      });
    });
  })

  //init
  sessionStorage.removeItem("userName")
  if(serverDomainUrl.toLowerCase().startsWith("file://"))serverDomainUrl = "http://xxx.30.14.122"
</script>
</html>